#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
using namespace std;
using ll = long long;
using T = int;
T rad(); // quick read
const int inf = 0x3f3f3f3f;
#define rf(i, n) for (int i = 1; i <= (n); ++i)
const int max_size = 5 + 100;
const int maxn = 5 + 100;

map<int, double> order;
int cnt[maxn];
void dfs(int jump, int left, double p) {
    if (cnt[1 << 0] == 2 || cnt[1 << 1] == 2 || cnt[1 << 2] == 2) {
        order[cnt[1 << 0] + cnt[1 << 1] + cnt[1 << 2]] += p;
        return;
    }

    if (jump == 0) {
        for (int mask = 0x4; mask; mask >>= 1)
            dfs(mask, left ^ mask, p / 3);
    } else {
        for (int mask = 0x4; mask; mask >>= 1) {
            if ((left & mask) == 0) continue;
            ++cnt[mask], dfs(mask, (left ^ mask) | jump, p / 2), --cnt[mask];
        }
    }
}

int main() {
    dfs(0, 0x7, 1);
    double ans = 0;
    for (auto p : order) ans += p.first * p.second;
    cout << ans;
}

T rad() {
    T back = 0;
    int ch = 0, posi = 0;
    for (; ch < '0' || ch > '9'; ch = getchar())
        posi = ch ^ '-';
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        back = (back << 1) + (back << 3) + (ch & 0xf);
    return posi ? back : -back;
}